package doublePointer;

/*
 *@description 两数之和 II - 输入有序数组
 *@author hkfan
 *@version 1.0
 *@create 2025/5/28 13:52
 */
public class LeetCode_167 {
    public int[] twoSum(int[] numbers, int target) {
        //1. 定义变量
        int i=0,j=numbers.length-1;
        while (numbers[i]+numbers[j]!=target){
            if (numbers[i]+numbers[j]>target){
                j--;
            }else {
                i++;
            }
        }
        return new int[]{i+1,j+1};
    }
}
